1 module d_sysdlog.bind;
2 extern(C):
3 import std.c.stdlib;
4 
5 /***
6   This file is part of systemd.
7 
8   Copyright 2011 Lennart Poettering
9 
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14 
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19 
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 
23   Ported to D 2015 by Laeeth Isharc
24 ***/
25 
26 alias uint64_t=ulong;
27 alias uint32_t=uint;
28 alias uint16_t=ushort;
29 alias uint8_t=ubyte;
30 alias int64_t=long;
31 alias int32_t=int;
32 alias int16_t=short;
33 alias int8_t=char;
34 
35 alias sd_id128_t=sd_id128 ;
36 
37 union sd_id128 {
38         uint8_t bytes[16];
39         uint64_t qwords[2];
40 }
41 struct iovec
42   {
43     void *iov_base;	/* Pointer to data.  */
44     size_t iov_len;	/* Length of data.  */
45   };
46 
47 int sd_journal_sendv( iovec *iov, int n);
48 int sd_journal_perror(const(char*)message);
49 int sd_journal_sendv_with_location(const(char*)file, const(char*)line, const(char*)func, const  iovec *iov, int n);
50 int sd_journal_perror_with_location(const(char*)file, const(char*)line, const(char*)func, const(char*)message);
51 int sd_journal_stream_fd(const(char*)identifier, int priority, int level_prefix);
52 
53 struct sd_journal;
54 
55 /* Open flags */
56 enum {
57         SD_JOURNAL_LOCAL_ONLY = 1,
58         SD_JOURNAL_RUNTIME_ONLY = 2,
59         SD_JOURNAL_SYSTEM = 4,
60         SD_JOURNAL_CURRENT_USER = 8,
61         SD_JOURNAL_SYSTEM_ONLY = SD_JOURNAL_SYSTEM, /* deprecated name */
62 };
63 
64 enum OpenFlags
65 {
66 	LocalOnly=1,
67 	RunTimeOnly=2,
68 	System=4,
69 	CurrentUser=8,
70 	SystemOnly=4
71 }
72 
73 /* Wakeup event types */
74 enum {
75         SD_JOURNAL_NOP,
76         SD_JOURNAL_APPEND,
77         SD_JOURNAL_INVALIDATE
78 };
79 
80 int sd_journal_open(sd_journal **ret, int flags);
81 int sd_journal_open_directory(sd_journal **ret, const(char*)path, int flags);
82 int sd_journal_open_files(sd_journal **ret, const(char*)*paths, int flags);
83 int sd_journal_open_container(sd_journal **ret, const(char*)machine, int flags);
84 void sd_journal_close(sd_journal *j);
85 
86 int sd_journal_previous(sd_journal *j);
87 int sd_journal_next(sd_journal *j);
88 
89 int sd_journal_previous_skip(sd_journal *j, uint64_t skip);
90 int sd_journal_next_skip(sd_journal *j, uint64_t skip);
91 
92 int sd_journal_get_realtime_usec(sd_journal *j, uint64_t *ret);
93 int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id128_t *ret_boot_id);
94 
95 int sd_journal_set_data_threshold(sd_journal *j, size_t sz);
96 int sd_journal_get_data_threshold(sd_journal *j, size_t *sz);
97 
98 int sd_journal_get_data(sd_journal *j, char*field, void **data, size_t *l);
99 int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t *l);
100 void sd_journal_restart_data(sd_journal *j);
101 
102 int sd_journal_add_match(sd_journal *j, const void *data, size_t size);
103 int sd_journal_add_disjunction(sd_journal *j);
104 int sd_journal_add_conjunction(sd_journal *j);
105 void sd_journal_flush_matches(sd_journal *j);
106 
107 int sd_journal_seek_head(sd_journal *j);
108 int sd_journal_seek_tail(sd_journal *j);
109 int sd_journal_seek_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t usec);
110 int sd_journal_seek_realtime_usec(sd_journal *j, uint64_t usec);
111 int sd_journal_seek_cursor(sd_journal *j, const(char*)cursor);
112 
113 int sd_journal_get_cursor(sd_journal *j, char **cursor);
114 int sd_journal_test_cursor(sd_journal *j, const(char*)cursor);
115 
116 int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from, uint64_t *to);
117 int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, const sd_id128_t boot_id, uint64_t *from, uint64_t *to);
118 
119 int sd_journal_get_usage(sd_journal *j, uint64_t *bytes);
120 
121 int sd_journal_query_unique(sd_journal *j, const(char*)field);
122 int sd_journal_enumerate_unique(sd_journal *j, const void **data, size_t *l);
123 void sd_journal_restart_unique(sd_journal *j);
124 
125 int sd_journal_get_fd(sd_journal *j);
126 int sd_journal_get_events(sd_journal *j);
127 int sd_journal_get_timeout(sd_journal *j, uint64_t *timeout_usec);
128 int sd_journal_process(sd_journal *j);
129 int sd_journal_wait(sd_journal *j, uint64_t timeout_usec);
130 int sd_journal_reliable_fd(sd_journal *j);
131 
132 int sd_journal_get_catalog(sd_journal *j, char **text);
133 int sd_journal_get_catalog_for_message_id(sd_id128_t id, char **text);